home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HyperLib 1997 Winter - Disc 1
/
HYPERLIB-1997-Winter-CD1.ISO.7z
/
HYPERLIB-1997-Winter-CD1.ISO
/
オンラインウェア
/
PRG
/
PowerFantasm 4.10 unreg.sit
/
PowerFantasm 410 unreg
/
Beginners guide
/
GUIDE EXAMPLES
/
EXAMPLE7.S
< prev
next >
Wrap
Text File
|
1996-06-21
|
2KB
|
42 lines
********************************************************************************
*EXAMPLE 7 - SETTING PIXELS *
*AUTHOR - STUART BALL JULY 94 *
*SCREEN MUST BE SET TO 256 COLOUR MODE FOR THIS EXAMPLE *
********************************************************************************
SCREENROW: EQU $0106 WIDTH OF EACH SCREEN LINE
DEVICELIST: EQU $08A8 THE ADDRESS OF DEVICELIST
GET_VRAM_ADDR:
MOVE.L DEVICELIST,A0
MOVE.L (A0),A0 POINT TO DEVICELIST
MOVE.L A0,A1 COPY ADDRESS OF DEVICE LIST
MOVE.L 22(A1),A1 CONTENTS OF GDPMAP
MOVE.L (A1),A1 BASE ADDRESS IN A1
MOVE.L (A1),A1 VRAM ABSOLUTE ADDRESS IN A1
**SET THE PIXEL AT 300,20 TO COLOUR 3
MOVE.W #500,D0 X COORDINATE OF PIXEL
MOVE.W #200,D1 Y COORDINATE
MOVE.W #20,D2 COLOUR
BSR PLOT PLOT THIS PIXEL
RTS
**PLOT IS A SUBROUTINE THATS PLOTS A PIXEL ON THE SCREEN IN THE COLOUR HELD IN D2
**NEEDS D0.W = X COORDINATE
** D1.W = Y COORDINATE
** D2.B = THE COLOUR
** A1 = VRAM BASE ADDRESS
**ALL REGISTERS REMAIN UNAFFECTED
PLOT: MOVEM.L D0-D3/A1,-(SP) SAVE THE REGISTERS WE USE
CLR.L D3
MOVE.W SCREENROW,D3 GET PHYSICAL LENGTH OF EACH SCREEN LINE
MULS D3,D1 Y COORDINATE TIMES THE LENGTH OF EACH LINE
ADD.L D0,D1 VRAM ADDRESS OF THIS PIXEL
ADD.L D1,A1 ABSOLUTE ADDRESS OF THIS PIXEL
MOVE.B D2,(A1) SET THE PIXEL TO THE COLOUR IN D2
MOVEM.L (SP)+,D0-D3/A1 RESTORE THE REGS TO HOW THEY WERE
RTS END OF SUBROUTINE PLOT
*********************END OF EXAMPLE 7***********************************